#coding=utf-8
import arcpy
import json

arcpy.env.overwriteOutput = True
spRef = arcpy.SpatialReference(4490)
with open(r'D:\WorkData\20250722JH\1.json','rb') as file:
    content = file.read().decode('utf-8')
data = json.loads(content)

dataCount = len(data['features'])
polygon_list = []
for i in range(dataCount):
    coordsList_Top = data['features'][i]['geometry']
    name = data['features'][i]['sk_name']
    skId = int(data['features'][i]['sk_id'])
    kurong = str(data['features'][i]['sk_kurong'])
    guimo = data['features'][i]['sk_guimo']
    print(name,skId,kurong,guimo)
    for coordsList in coordsList_Top:
        ArcpyPoint_List = [arcpy.Point(*coords) for coords in coordsList]
        ArcpyArray_List = arcpy.Array(ArcpyPoint_List)
        ArcpyPolygon = arcpy.Polygon(ArcpyArray_List, spRef)
        polygon_list.append([ArcpyPolygon, name, skId,kurong,guimo])
m_polygon = arcpy.CreateFeatureclass_management(r'D:\WorkData\20250722JH\shp', 'sk.shp' , 'POLYGON',
                                                spatial_reference=spRef)
arcpy.AddField_management(m_polygon, 'name', 'TEXT')
arcpy.AddField_management(m_polygon, 'skId', 'TEXT')
arcpy.AddField_management(m_polygon, 'kurong', 'TEXT')
arcpy.AddField_management(m_polygon, 'guimo', 'TEXT')


cs = arcpy.da.InsertCursor(m_polygon,['SHAPE@', 'name', 'skId','kurong','guimo'])
for polygon in polygon_list:
    cs.insertRow(polygon)
del cs